package com.zjjt.dc.modules.datacatch.service.lw.impl;

import cn.hutool.json.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zjjt.dc.common.query.QueryGenerator;
import com.zjjt.dc.modules.datacatch.entity.QueryCondition;
import com.zjjt.dc.modules.datacatch.entity.lw.DcCatchDataLwWh;
import com.zjjt.dc.modules.datacatch.service.lw.IDcDataCatchLwWhService;
import com.zjjt.dc.modules.datacatch.service.lw.ILWDataExportService;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class LWDataExportService implements ILWDataExportService {

    private static final Logger logger = LoggerFactory.getLogger(LWDataExportService.class);
    @Autowired
    IDcDataCatchLwWhService dcCatchDataLwWhService;
    @Override
    public JSONArray getDataByCondition(QueryCondition condition) {
        QueryWrapper<DcCatchDataLwWh> queryWrapper = QueryGenerator.initQueryWrapper(new DcCatchDataLwWh(), null);;
        queryWrapper.between("ex_create_time",condition.getBeginTime(),condition.getEndTime());
        List<DcCatchDataLwWh> list = dcCatchDataLwWhService.list(queryWrapper);
        JSONArray jsonArray = new JSONArray(list);
        return jsonArray;
    }
}
